home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Menu Fixer 1.0 Source / Menu fixer ƒ / MSG Shell ƒ / msg environment.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-14  |  2.5 KB  |  96 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        msg environment.c
  4.  
  5. Purpose:    This module handles initializing the environment and
  6.             checking for various environmental characteristics.
  7.  
  8.  
  9. Menu Fixer -=- synchronize menu IDs and menu resource IDs
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "GestaltEqu.h"
  30. #include "msg environment.h"
  31. #include "msg apple events.h"
  32. #include "msg graphics.h"
  33. #include "msg menus.h"
  34.  
  35. Boolean            gHasColorQD;
  36. Boolean            gHasAppleEvents;
  37. Boolean            gHasFSSpecs;
  38. Boolean            gStandardFile58;
  39. Boolean            gDone;
  40. Rect            gDragRect;
  41. Rect            gSizeRect;
  42.  
  43. void CheckEnvironment(void)
  44. {
  45.     long    gestalt_temp;
  46.     OSErr    isHuman;
  47.     
  48.     isHuman = Gestalt(gestaltQuickdrawVersion, &gestalt_temp);
  49.     gHasColorQD = !(isHuman || (gestalt_temp < gestalt8BitQD));
  50.     
  51.     GetMainScreenBounds();
  52.     
  53.     isHuman = Gestalt(gestaltFSAttr, &gestalt_temp);
  54.     gHasFSSpecs=((isHuman==noErr) && (gestalt_temp & (1 << gestaltHasFSSpecCalls)));
  55.  
  56.     isHuman = Gestalt(gestaltStandardFileAttr, &gestalt_temp);
  57.     gStandardFile58=((isHuman==noErr) && (gestalt_temp & (1 << gestaltStandardFile58)));
  58.  
  59.     gHasAppleEvents=0;
  60.     isHuman = Gestalt(gestaltAppleEventsAttr, &gestalt_temp);
  61.     if(!isHuman) {
  62.         gHasAppleEvents = 1;
  63.         SetUpAppleEvents();
  64.     }
  65. }
  66.  
  67. void InitEnvironment(void)
  68. {
  69.     Handle        MBARHandle;
  70.     int            i;
  71.     
  72.     gHelpHeight=200;
  73.     gHelpWidth=300;
  74.     
  75.     for (i=0; i<NUM_HELP; i++)
  76.         gHelp[i]=0L;
  77.     
  78.     MBARHandle = GetNewMBar(400);
  79.     SetMenuBar(MBARHandle);
  80.     gAppleMenu = GetMHandle(appleMenu);
  81.     gFileMenu = GetMHandle(fileMenu);
  82.     gEditMenu = GetMHandle(editMenu);
  83.     gHelpMenu = GetMenu(helpMenu);
  84.     InsertMenu(gHelpMenu, -1);
  85.     
  86.     AddResMenu(gAppleMenu, 'DRVR');
  87.     AdjustMenus();
  88.     DrawMenuBar();
  89.     
  90.     gDragRect = screenBits.bounds;
  91.     gDragRect.top += 4;
  92.     gDragRect.left += 4;
  93.     gDragRect.right -= 4;
  94.     gDragRect.bottom -= 4;
  95. }
  96.